home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / exec / comp.sys.handhelds_2135_000000.msg next >
Internet Message Format  |  1995-03-31  |  4KB

  1. Path: helens!shelby!rutgers!usc!sdd.hp.com!hplabs!hpl-opus!hpnmdla!darrylo
  2. >From: darrylo@hpnmdla.HP.COM (Darryl Okahata)
  3. Newsgroups: comp.sys.handhelds
  4. Subject: Unix-link PATH searching for the HP-48SX
  5. Message-ID: <1570006@hpnmdla.HP.COM>
  6. Date: 11 Jul 90 20:20:39 GMT
  7. Organization: HP Network Measurements Div, Santa Rosa, CA
  8. Lines: 106
  9.  
  10.  
  11.      Here is yet another method for accessing programs in other
  12. directories.  It introduces the concept of a Unix-like "PATH" variable,
  13. which gives a list of directories to search.  This program, called
  14. "EXEC", works just like Jan Christiaan van Winkel's (jc@atcmp.nl) SVC
  15. function, except that it will search multiple paths.  You enter the
  16. arguments to your function on the stack, enter the name of your function
  17. (e.g., 'MYFUNC'), and then execute "EXEC".
  18.  
  19.      To use it, you need a variable called "EXECPATH" in the HOME
  20. directory, and this variable should contain a list of directory paths
  21. (in list form).  For example, one possible value for EXECPATH could be:
  22.  
  23.     { { SYS } { ETC } { ETC ETC } HOME { } }
  24.  
  25. This causes EXEC to search the following directories for functions:
  26.  
  27.     { SYS }
  28.     { ETC }
  29.     { ETC ETC }
  30.     HOME
  31.     the current working directory
  32.  
  33. Note that HOME does not have to be in a list (for that matter, directory
  34. paths with only one name do not have to be in a list, but it makes it
  35. easier to debug).  Also note that placing HOME in this list is
  36. redundant; as everything searches HOME, HOME should never be placed in
  37. this list.
  38.  
  39.  
  40. Notes/problems:
  41.  
  42. 1. EXECPATH does not necessarily come from the HOME directory.  Strange
  43.    things will happen if EXECPATH resides in the "current directory" or
  44.    in one of the directories given by EXECPATH.
  45.  
  46. 2. The name "EXECPATH" is too long.  It should be shortened to save
  47.    time and space.
  48.  
  49. 3. EXEC is slow.  The overhead in using EXEC is at least 0.1 sec (I
  50.    don't know what the overhead in using SVS is, however).  The actual
  51.    overhead depends on how large and complex your EXECPATH happens to
  52.    be.  EXEC should be rewritten in assembly language.  It should,
  53.    perhaps, keep more things on the stack and not in local variables.
  54.  
  55. 4. EXEC is big (240 bytes).
  56.  
  57. 5. If "{ }" is not contained in the EXECPATH list, the current working
  58.    directory will not be searched.
  59.  
  60. 6. Some people will want to remove the code that handles "{ }" (searches
  61.    the current working directory).  This will increase speed and
  62.    decrease program size.  To do this, replace the lines that say:
  63.  
  64.         IF DUP SIZE 0
  65.     ==
  66.         THEN DROP cwd
  67.         END EVAL
  68.  
  69.    with:
  70.  
  71.         EVAL
  72.  
  73. 7. Searching HOME is redundant.
  74.  
  75.  
  76.      -- Darryl Okahata
  77.     UUCP: {hplabs!, hpcea!, hpfcla!} hpnmd!darrylo
  78.     Internet: darrylo%hpnmd@hp-sde.sde.hp.com
  79.  
  80. DISCLAIMER: this message is the author's personal opinion and does not
  81. constitute the support, opinion or policy of Hewlett-Packard or of the
  82. little green men that have been following him all day.
  83.  
  84.  
  85. ===============================================================================
  86. Store the following in a variable called "EXEC" in the HOME directory.
  87. Checksum: #19683d
  88. -------------------------------------------------------------------------------
  89. %%HP: T(3)A(D)F(.);
  90. \<< PATH EXECPATH
  91. SIZE 1 \-> cwd end i
  92.   \<<
  93.     DO EXECPATH i
  94. GET
  95.       IF DUP SIZE 0
  96. ==
  97.       THEN DROP cwd
  98.       END EVAL
  99.       IF
  100.         IFERR RCL 1
  101.         THEN
  102.           IF 'i'
  103. INCR end >
  104.           THEN cwd
  105. EVAL " :NOT FOUND"
  106. + DOERR
  107.           END 0 0
  108.         END
  109.       THEN cwd EVAL
  110. EVAL 1
  111.       END
  112.     UNTIL
  113.     END
  114.   \>>
  115. \>>
  116.  
  117.  
  118. From helens!shelby!decwrl!elroy.jpl.nasa.gov!sdd.hp.com!hp-pcd!hpcvia!scottb Thu Jul 12 17:04:36 PDT 1990
  119. Status: RO